<template>
	<div class="body">
		<div class='main'>
			<div class="bannerImage">
				<img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Ffuke.fenghuangfc.com%2Fuploads%2Fallimg%2F160714%2F1-160G4151Z4125.png&refer=http%3A%2F%2Ffuke.fenghuangfc.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1633004476&t=029556dec685d303326ef4de0882fdc3" alt=""/>
			</div>
			<div class="goodsList">
				<div class="goods" v-for="(item,index) in bargainList">
					<div class="goods-lift">
						<img class="image" :src="item.image" alt="">
					</div>
					<div class="goods-right">
						<div class="goods-title">{{item.title}}</div>
						<div class="goods-price">原价：{{item.price}}</div>
						<div class="goods-bargain-price">
							<text>可砍至：</text>￥{{item.bargain_price}}
							<button class="bargain-button" @click="toBargainRecode(item.id)">参与砍价</button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	
</template>
<script>
	export default {
		data: function() {
			return {
				bargainList: [],
			};
		},
		onLoad(options) {
			this.getBargainList();
		},
		methods: {
			getBargainList() {
				this.$http.get('bargain/getBargainList').then(res => {
					console.log(res.data.data)
					var data = res.data.data
					this.bargainList = data
				})
			},
			toBargainRecode(id) {
				uni.navigateTo({
					'url': '../BargainRecode/BargainRecode?id='+id
				})
			}
		},
	}
</script>

<style scoped lang="scss">
	@import 'Bargain.scss';
</style>
